import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;

public abstract class FileServer {

	private int port;
	private ArrayList<String> fileList;
	
	private int bufferSize = 8192;
	
	public FileServer(int port){
		this.port = port;
		initFileList();
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		if(port <= 0) return;
		this.port = port;
	}
	
	public int getBufferSize(){
		return bufferSize;
	}

	public ArrayList<String> getFileList() {
		return fileList;
	}
	
	public void initFileList(){
		fileList = new ArrayList<String>();
		fileList.add("img01.jpg");
		fileList.add("img02.jpg");
	}
	
	public File getAFileContent(String fileName) throws IOException{
		String shareFolderPath = System.getProperty("user.dir") + "\\Share\\";
		String filePath = shareFolderPath + fileName;
		
		File f = new File(filePath);
		if(!f.exists()) return null;
		return f;
	}
	
	public abstract void showInfo();
	
	public abstract void serve();
	
}
